package com.example.add8_17.model;

import com.example.add8_17.base.BaseModel;
import com.example.add8_17.base.BaseObserver;
import com.example.add8_17.bean.HomeBean;
import com.example.add8_17.not.ApiService;
import com.example.add8_17.not.HttpUlist;
import com.example.add8_17.not.RxUlist;

import io.reactivex.Observable;

public class HomeModel extends BaseModel {
    public void homedata(HomeCallBack callBack,int page){
        ApiService apiServer = new HttpUlist().getApiServer(ApiService.url, ApiService.class);
        Observable<HomeBean> gethomedata = apiServer.gethomedata(page,60);
        gethomedata.compose(RxUlist.ReObservableTransformer())
                .subscribe(new BaseObserver<HomeBean>(this) {
                    @Override
                    protected void onSuccess(HomeBean homeBean) {
                        callBack.onSuccess(homeBean);
                    }

                    @Override
                    protected void onFali(String message) {
                        callBack.onFali(message);
                    }
                });
    }
}
